package com.cmw.auntapp.presenter;

import com.cmw.auntapp.constant.API;
import com.cmw.auntapp.constant.CommandType;
import com.cmw.auntapp.core.base.BasePresenter;
import com.cmw.auntapp.core.base.IBaseView;
import com.cmw.auntapp.core.util.DateUtil;
import com.cmw.auntapp.model.OrderModel;

import java.util.HashMap;
import java.util.Map;

import static com.cmw.auntapp.constant.API.DAY_SETTLE_LIST_GET;
import static com.cmw.auntapp.constant.API.DAY_SETTLE_SUM_GET;
import static com.cmw.auntapp.constant.API.ORDER_INFO_GET;
import static com.cmw.auntapp.constant.API.ORDER_LIST_GET;
import static com.cmw.auntapp.constant.API.ORDER_SET_ARRIVE_TIME;
import static com.cmw.auntapp.constant.API.ORDER_SUM_GET;
import static com.cmw.auntapp.constant.API.ORDER_XSTATUS_UPDATE;
import static com.cmw.auntapp.constant.Constant.REQUESTSOURCE_AUNT;
import static com.cmw.auntapp.constant.Constant.SHOW_LOADING_KEY;
import static com.cmw.auntapp.constant.Constant.SHOW_LOADING_YES;

/**
 * @desc: 会员资金交易 Presenter
 * @author: chengmingwei
 * @date: 2021/06/02 23:09 PM
 * @contact: phone(微信同号):13922111489 / email: 340360491@qq.com
 */
public class AmountThansferPresenter extends BasePresenter<Map<String, String>> {
    private IBaseView iBaseView;

    private OrderModel orderModel;

    public AmountThansferPresenter(IBaseView iBaseView) {
        this.iBaseView = iBaseView;
        init();
    }

    /**
     * 获取阿姨应收/实收列表
     *
     * @param startDate 开始日期
     */
    public void getSumAmount(String startDate) {
        Map<String, String> params = getPars(startDate);
        postBody(DAY_SETTLE_SUM_GET, params, CommandType.GET);
    }


    /**
     * 获取阿姨每日结算列表
     *
     * @param startDate 开始日期
     *
     */
    public void getList(String startDate) {
        Map<String, String> params = getPars(startDate);
        postBody(DAY_SETTLE_LIST_GET, params, CommandType.LIST);
    }

    private Map<String, String> getPars(String startDate) {
        String endDate = DateUtil.addDays(startDate, 1);
        Map<String, String> params = new HashMap<>();
        params.put("requestSource", REQUESTSOURCE_AUNT+""); // 对象来源：1：阿姨，2：客户
        params.put("startDate", startDate);
        params.put("endDate", endDate);
        return params;
    }


    @Override
    protected IBaseView getView() {
        return iBaseView;
    }


}
